package com.kaibes.platform.member.db;

import java.util.List;

import org.springframework.stereotype.Service;

import com.kaibes.core.base.util.IntegerUtils;
import com.kaibes.orm.curd.QueryBuilder;
import com.kaibes.web.api.ResponseServiceImpl;

@Service
public class MemberVipService extends ResponseServiceImpl<MemberVip>{

    public MemberVip getIdNameAndLevelById(Short id) {
        return getById(id, "id", "name", "level");
    }
    
    public MemberVip getByLevel(Short level) {
        return get(QueryBuilder.newBuilder().eq("level", level).build());
    }
    
    public short getLevelById(Short id) {
        return IntegerUtils.returnShort(get(QueryBuilder.newBuilder().eq("id", id).build()).getLevel());
    }
    
    public List<MemberVip> listByHasTag() {
        return list(QueryBuilder.newBuilder().notNullValue("tag").build());
    }
    
}
